from __future__ import unicode_literals
from mongoengine import *
from AnalysisService.MMKeyUtil import AVISONY_CAPTCHA_COLLECTION


class AYCaptchaModel(Document):
    phonenumber = StringField(max_length=45)
    captcha = StringField(max_length=45)
    name = StringField(max_length=45)
    smscode = StringField(max_length=45)
    createtime = DateTimeField(auto_now=True)
    meta = {
        'collection': AVISONY_CAPTCHA_COLLECTION,  # 设置集合名称
        'strict': False,
    }  # 数据库中的集合

    def __unicode__(self):
        return self.phonenumber

# {
#     "_id": "5bfb40cdc3e46403164990ae",
#     "phonenumber": "18086499527",         // 手机号
#     "captcha": "4321",                    // 验证码
#     "name": "4321",                       // 客户名
#     "smscode": "4321",                    // 短信编码
#     "createtime": 1543192781.5530581      // 创建时间
# }
